package cn.njxzc.examples;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Enumeration;

public class FilesList implements Enumeration {
	private String[] files;
	private int counter = 0;

	FilesList(String[] args) {
		files = args;
	}

	public boolean hasMoreElements() {
		if (counter < files.length) {
			return true;
		} else {
			return false;
		}
	}

	public Object nextElement() {
		FileInputStream in = null;
		String file = files[counter];
		counter++;
		try {
			in = new FileInputStream(file);
		} catch (IOException e) {
			System.out.println(files[counter] + "文件打开出错");
		}
		return in;
	}
}